package com.darren.euc.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;

/**
 * 帐单详情
 * Created by IIS72013 2018/3/22.
 */
@Entity
@Table(name = "euc_bill_detail")
public class BillDetail extends BaseEntity implements Serializable {

	private static final long serialVersionUID = -1698481384545949480L;
	
	@Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    @Column(name = "order_id")
    private Integer order_id;//订单ID    
    
    @Column(name = "order_code")
    private String orderCode;//订单编号    
    
    
    @Column(name = "contract_id")  
   	private Integer contractId;
    
    @Column(name = "client_id")  
   	private Integer clientId;
    
    @Column(name = "hire_purchase_number")//只针对工位订单有效
    private String hirePurchaseNumber;//分期编号
    
    
    @Column(name = "order_type",columnDefinition = "int  comment '帐单类型'")
    private Integer orderType;//帐单类型：1 工位帐单，2 会议室帐单，3 打印帐单，4 临时订单的帐单       
    
    @Column(name = "order_type_name",columnDefinition = "varchar(50)  comment '帐单类型名'")
    private String orderTypeName;//帐单类型：1 工位帐单，2 会议室帐单，3 打印帐单，4 临时订单的帐单   
    
    
    @Column(name = "bill_description")
    private String billDescription;//款项说明
    
    
    @Column(name = "payable_amount",columnDefinition = "Decimal(13,2) default '0' comment '应收总额'")
    private Double payableAmount;//应付款总额

    @Column(name = "paid_amount",columnDefinition = "Decimal(13,2) default '0' comment '回款金额'")
    private Double paidAmount;//回款金额   
    
    
    @Column(name = "bill_status",columnDefinition = "bigint  comment '帐单状态'")
    private Integer billStatus;//帐单状态：1 未结清;2 已结清;3 已逾期
    
    
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    @Column(name = "bill_date")//回款日期
    private Date billDate;    
    
    @Column(name = "payment_mode_id",columnDefinition = "bigint  comment '付款方式编号'")
    private Integer paymentModeId;//付款方式编号
    
    @Column(name = "payment_mode",columnDefinition = "varchar(50)  comment '付款方式名称'")
    private String  paymentMode;//付款方式    
    
    @Column(name = "remark",columnDefinition = "varchar(250)  comment '备注'")
    private String  remark;//付款方式    
    
    /**
     * 所属帐单
     */
    @JsonIgnore
    @ManyToOne
    @JoinColumn(name = "bill_id")
    private Bill bill ;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getOrder_id() {
		return order_id;
	}

	public void setOrder_id(Integer order_id) {
		this.order_id = order_id;
	}

	public String getOrderCode() {
		return orderCode;
	}

	public void setOrderCode(String orderCode) {
		this.orderCode = orderCode;
	}

	public Integer getContractId() {
		return contractId;
	}

	public void setContractId(Integer contractId) {
		this.contractId = contractId;
	}

	public String getHirePurchaseNumber() {
		return hirePurchaseNumber;
	}

	public void setHirePurchaseNumber(String hirePurchaseNumber) {
		this.hirePurchaseNumber = hirePurchaseNumber;
	}

	public Integer getOrderType() {
		return orderType;
	}

	public void setOrderType(Integer orderType) {
		this.orderType = orderType;
	}

	public String getOrderTypeName() {
		return orderTypeName;
	}

	public void setOrderTypeName(String orderTypeName) {
		this.orderTypeName = orderTypeName;
	}

	public String getBillDescription() {
		return billDescription;
	}

	public void setBillDescription(String billDescription) {
		this.billDescription = billDescription;
	}

	public Double getPayableAmount() {
		return payableAmount;
	}

	public void setPayableAmount(Double payableAmount) {
		this.payableAmount = payableAmount;
	}

	public Double getPaidAmount() {
		return paidAmount == null?0D:paidAmount;
	}

	public void setPaidAmount(Double paidAmount) {
		this.paidAmount = paidAmount;
	}

	public Integer getBillStatus() {
		return billStatus;
	}

	public void setBillStatus(Integer billStatus) {
		this.billStatus = billStatus;
	}

	public Date getBillDate() {
		return billDate;
	}

	public void setBillDate(Date billDate) {
		this.billDate = billDate;
	}

	public Integer getPaymentModeId() {
		return paymentModeId;
	}

	public void setPaymentModeId(Integer paymentModeId) {
		this.paymentModeId = paymentModeId;
	}

	public String getPaymentMode() {
		return paymentMode;
	}

	public void setPaymentMode(String paymentMode) {
		this.paymentMode = paymentMode;
	}

	public Bill getBill() {
		return bill;
	}

	public void setBill(Bill bill) {
		this.bill = bill;
	}

	public Integer getClientId() {
		return clientId;
	}

	public void setClientId(Integer clientId) {
		this.clientId = clientId;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}
	
	
}
